<?php

class Mail{
	
	function __construct($subject, $message){
		$this->_Mail($subject,$message);
	}
	
	function __destruct(){
		unset($_subject,$_message);
	}
	
	private $_subject,$_message;
	
	private function _Mail($subject,$message){
		$this->_subject =$subject;
		$this->_message =$message;
	}
	
	public function send($to){
		if(@mail($to, $this->_subject, wordwrap($this->_message,70), $this->_generateHeader())){
		 	$this->_sended=true;
		}
	}
	
	private $_sended = false;
	
	public function isSended(){
		return $this->_sended;
	}
			
	private static function _generateHeader(){
		$headers  = "From: Jobhjalpen <noreply@job.com>\r\n";
	    $headers .= "Reply-To: info@my_site.com\r\n";
	    $headers .= "Return-Path: info@my_site.com\r\n";
	    $headers .= "X-Mailer: JobSystemMailer\n";
	    $headers .= 'MIME-Version: 1.0' . "\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
		return $headers;
	}
}
?>